Skip to content

feat(tools): add document_cleanup tool#89

Open
gclpixel wants to merge 2 commits into
CodingWithCalvin:mainfrom
gclpixel:feature/DocumentCleanup
Open

feat(tools): add document_cleanup tool#89
gclpixel wants to merge 2 commits into
CodingWithCalvin:mainfrom
gclpixel:feature/DocumentCleanup

Conversation

@gclpixel
Copy link
Copy Markdown

Description

Add missing document cleanup tool for running the code clean up in an active document.

Tools to Implement

Tool Description
document_cleanup Run the visual studio code cleanup tool on the active document

Notes

  • Extends existing document tools category
  • The internal command name is "EditorContextMenus.FileHealthIndicator.RunDefaultCodeCleanup"

Type of Change

  • feat - New feature
  • fix - Bug fix
  • docs - Documentation only
  • refactor - Code change that neither fixes a bug nor adds a feature
  • test - Adding or updating tests
  • chore - Maintenance tasks
  • ci - CI/CD changes

Related Issues

Checklist

  • My code follows the project's code style
  • I have tested my changes locally
  • I have updated documentation if needed
  • My commits follow the conventional commit format
  • This PR has a descriptive title using conventional commit format

Ebersbach, Stephan added 2 commits May 18, 2026 15:54
Added RunCodeCleanupAsync to service interfaces, client, and server to enable code cleanup on open documents via DTE command. Introduced the document_cleanup server tool in DocumentTools for external access, with documentation and attributes for discoverability.
return success ? $"Saved: {path}" : $"Document not found or failed to save: {path}";
}

[McpServerTool(Name = "document_cleanup", Destructive = true, Idempotent = true)]
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if this is really correct.
The code cleanup is destructive because it changes the file, and in normal use case, execute the clean up twice change nothing.

}

[McpServerTool(Name = "document_cleanup", Destructive = true, Idempotent = true)]
[Description("Run code cleanup on an open document in Visual Studio. The document must already be open in VS. Activates the document and executes the 'Edit.RunCodeCleanupOnFile' command.")]
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be 'EditorContextMenus.FileHealthIndicator.RunDefaultCodeCleanup'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant